<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__PUBLIC__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Service/common/center/index.css" rel="stylesheet" type="text/css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>客服中心</title>
</head>
<body>
	<div class="head">
		<div class="head-content">
			<div class="row">
				<div class="col-2"><p>客户信息</p></div>
				<div class="col-10 text-r">
					<div class="head-sub1 head-sub borderR"><i class="Hui-iconfont Hui-iconfont-order"></i>工单统计</div>
					<div class="head-sub2 head-sub borderR"><i class="Hui-iconfont Hui-iconfont-dangan"></i>知识库</div>
					<div class="head-sub3 head-sub borderR"><i class="Hui-iconfont Hui-iconfont-comment"></i>待处理 {$count.ing}</div>
					<div class="head-sub4 head-sub borderR"><i class="Hui-iconfont Hui-iconfont-yiguanzhu1"></i>已处理 {$count.ed}</div>
					<div class="head-sub4 head-sub userName">{$user.real_name}</div>
					<div class="head-sub4 head-sub"><i class="Hui-iconfont Hui-iconfont-daochu"></i><a href="{:U('Admin/Index/loginOut')}">退出</a></div>
				</div>
			</div>
		</div>
	</div>
	<div class="nav">
		<div class="nav-content">
			<div class="nav-tel">
				<i class="Hui-iconfont Hui-iconfont-tel2"></i>&nbsp;<span class="telInfo"></span>接通中···
			</div>
			<div class="nav-search">
				<form action="" method="post">
					电话：<input type="text" class="input-text " id="searchTel">
					姓名：<input class="input-text" id="searchName">
					<span class="btn btn-primary radius btn_h" id="search">搜索</span>
				</form>
			</div>
			
		</div>
	</div>

	<div class="content">
		<div class="row content-line1">
			<div class="left customerLogo">
				<i class="Hui-iconfont Hui-iconfont-user"></i>&nbsp;客户信息
			</div>
			<div class="right">
				<a href="javascript:;" id="createCustomer" class="blue">创建用户</a>
				<a href="javascript:;" id="changeUser">切换用户({$data|count})&nbsp;<i class="Hui-iconfont Hui-iconfont-arrow3-bottom"></i></a>
				
			</div>
		</div>
		<div class="row">
			<div class="col-6 verBtn"><button class="btn radius f-r">待验证</button></div>
			<div class="col-6 col_type"><button class="btn radius f-r ml-20" id="customerEdit">编辑</button><button class="btn radius f-r" uid="{$data[0].id}" id="customerInfoBtn">更多信息</button></div>
		</div>
		<div class="row customerInfo">
			<div class="col-6 text-c">
				<div class="row">
					<div class="col-3 touPadd">
						<img class="img-responsive f-r" src="Tpl/Service/common/center/logo.png">
					</div>
					<div class="col-8 text-l message_pad">
						<span class="customerNmae">{$data[0].name}</span>
						<if condition='$data[0]["sex"] eq "M"'>
							<img src="Tpl/Service/common/sms/man.jpg">
						<else/>
							<img src="Tpl/Service/common/sms/woman.jpg">
						</if>
						
						<span class="customerType">{$data[0].ugroup}</span>
						<span class="customerTel">{$data[0].tel}</span>
					</div>
				</div>
					
			</div>
			<div class="col-6 text-l">
				<div class="row">
					<div class="col-2 homeImg">
						<img class="img-responsive f-r" src="Tpl/Service/common/sms/home.jpg">
					</div>
					<div class="col-9">
						<div class="customerAddres">
							<span>家庭信息({$data[0].families|count})</span>
							<volist name="data[0].families" id="vo" empty="无家庭信息">
								<span class="cusAddress"><i class="Hui-iconfont Hui-iconfont-home"></i>{$vo.address}</span>
							</volist>
						</div>
					</div>
				</div>		
			</div>
		</div>
	</div>

	<div class="order">
		<div class="row">
			<div class="left customerLogo"><i class="Hui-iconfont Hui-iconfont-xiaoxi1"></i>&nbsp;进行中的工单信息</div>
			<div class="right">
				<a href="javascript:;" uid="{$data[0].id}" id="seeOrder" class="blue">查看所有工单</a>
				<a href="javascript:;" id="createOrder" uid="{$data[0].id}">创建工单</a>
			</div>
		</div>
		<div class="order-content">
			<div class="row orderNameDiv">
				<span class="orderName">{$data[0].name}的工单</span>
			</div>
			<div class="row">
			<!-- 循环DIV -->
				
				<!-- 循环结束 -->
				<volist name="data[0]['orders']" id="ko" empty="无工单信息">
					<div class="col-6 order-padding massage_w">
						<div class="order-sub orderBorder">
							<div class="order-padd">
								<div class="row"><span class="orderTitle">{$ko.DATA_9}</span><span>({$ko.DATA_10})</span></div>
								<div class="row orderContentP"><span class="orderContent">{$ko.DATA_12}</span></div>
								<div class="row"><span>地址:{$ko.DATA_8}</span></div>
								<div class="order-line"></div>
								<div class="row orderCreat"><span>创建人：{$data[0].name}&nbsp;通过电话来电</span></div>
								<div class="row orderCreat"><span>时间：{$ko.create_time}</span></div>
								<div class="row">
									<span class="orderJinji"><i class="Hui-iconfont Hui-iconfont-shenhe-weitongguo"></i>紧急工单</span>
									<empty name="$ko['TO_USER']">
										<span class="orderAssing"><img class="img-responsive" src="Tpl/Service/common/center/noassign.png">待指派</span>
									<else/>
										<span class="orderAssing"><img class="img-responsive" src="Tpl/Service/common/center/assign.png">已指派</span>
									</empty>
									
								</div>
							</div>
							<div class="row orderBlue">
								<div class="col-4 blueBorder img_wid"><img src="Tpl/Service/common/center/noassign.png"></div>
								<div class="col-4 blueBorder img_wid"><img src="Tpl/Service/common/center/nodel.png"></div>
								<div class="col-4 infoBtn img_wid" uid="{$ko.ID}"><img src="Tpl/Service/common/center/see.png"></div>
							</div>	
						</div>
					</div>
				</volist>

			</div>
		</div>
		
	</div>
	
<!--
	     
	    <iframe src="/index.php?m=Service&c=Order&a=orderList&customerId={$data[0].id}" frameborder="0" id="order"><input type="button" onclick="javascript:window.top.close();" value="关闭" /></iframe>
-->
	
	
	
	<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.admin.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/getUrl.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="Tpl/Service/common/center/index.js"></script>
	<script type="text/javascript">
	// 全局
		var info={
			id:0,//业主id
			tel:''
		};
	$(function(){
		info.id=$("#createOrder").attr("uid");
		info.tel=$.getUrlVar('tel');
		work.init();
	});
        
//功能实现
        var work={
	/*·····························初始化························*/
	init:function(){
		this.eventListen();
	},
	/*·····························事件监听························*/
	eventListen:function(){
		$(".telInfo").text(info.tel);
		// 创建工单
		$(document).on("click","#createOrder",function(){
			var url='/index.php?m=Service&c=Order&a=create&id='+info.id;
			var title="创建工单";
			work.layerOpen(title,url);
            
		});
		//编辑用户
		$(document).on("click","#customerEdit",function(){
			var url='/index.php?m=Service&c=Center&a=edit&id='+info.id+'&tel='+info.tel;
			var title="客户编辑";
			work.layerOpen(title,url);
		});
		// 切换用户
		$(document).on("click","#changeUser",function(){
			if(info.tel==undefined){
				info.tel='';
			}
			window.location.href="/index.php?m=Service&c=Center&a=choice&tel="+info.tel;
		});
		//搜索
		$(document).on("click","#search",function(){
			var tel=$("#searchTel").val();
			var name=$("#searchName").val();
			window.location.href='/index.php?m=Service&c=Center&a=choice&tel='+tel+'&name='+name;
		});
		// 查看所有工单
		$(document).on("click","#seeOrder",function(){
			var id=$(this).attr("uid");
			var title='查看所有工单';
			var url='/index.php?m=Service&c=Order&a=orderList&customerId='+id;
			work.layerOpenB(title,url);
		});
		// 查看工单
		$(document).on("click",".infoBtn",function(){
			var id=$(this).attr("uid");
			var title="工单详情";
			var url='/index.php?m=Service&c=Order&a=info&ID='+id;
			work.layerOpen(title,url);
		});
		// 创建用户
		$(document).on("click","#createCustomer",function(){
			$.post("/index.php?m=Admin&c=Customer&a=add",{tel:info.tel},function(data){
				if(data.stat==1){
					work.layerOpen('创建用户','/index.php?m=Service&c=Center&a=create&tel='+info.tel+'&customerId='+data.pk);
				}else{
					layer.msg(data.msg);
				}
			});
			
		});
		//查看用户更多信息
		$(document).on("click","#customerInfoBtn",function(){
			var id=$(this).attr("uid");
			var url='/index.php?m=Service&c=Center&a=getCustomer&id='+id;
			work.layerCap("用户详情",url);
		});
	},
	/*·····························功能性函数························*/
	// iframe页面弹窗
	layerOpen:function(title,url){
		layer.open({
			type: 2,
			area: ['800px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url,
			cancel:function(){
				location.replace(location.href);
			}
		});
	},
	//大弹窗
	layerOpenB:function(title,url){
		layer.open({
			type: 2,
			area: ['980px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url
		});
	},
		//创建用户
	layerCap:function(title,url){
		layer.open({
			type:2,
			shade: false,
		    title: title, //不显示标题
		    area: ['800px', '400px'],
		    content: url, //捕获的元素
		    cancel: function(index){
		        
		    }
		});
	}
}
        
//        $("#createOrder").click(
//            function(){
//                $("#order").addClass("show");
//            }
//        )
	</script>
	</body>
	</html>